package com.gosling.cloudspace.controller;


import com.gosling.cloudspace.common.entity.pojo.OrderInfoPO;
import com.gosling.cloudspace.common.service.OrderInfoService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 订单
 *
 * @email 1793327033@qq.com
 * @classname OrderInfoController
 * @author: osc_lihonglin
 * @date: 2022/7/30 12:00
 */
@RestController
@RequestMapping("/orderInfo")
public class OrderInfoController {

    @Resource
    private OrderInfoService orderInfoService;

    /***
     * 订单查询
     * spring缓存机制
     *
     * @param orderId
     * @return
     */
    @CacheEvict(allEntries = true)
    @GetMapping("/one/{orderNo}")
    public OrderInfoPO findByOrderNo(@PathVariable("orderNo") String orderId) {
        return orderInfoService.findByOrderNo(orderId);
    }
}
